import os
import django
from celery import Celery
from django.conf import settings

# 设置系统环境变量，安装django，必须设置，否则在启动celery时会报错
# djangoProject1.settings
"""
启动worker  celery -A 电商项目 worker -l debug -P eventlet
"""


os.environ.setdefault('DJANGO_SETTINGS_MODULE', '电商项目.settings')


django.setup()

app = Celery('电商项目')
app.config_from_object('django.conf:settings')

app.autodiscover_tasks()
